﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;


namespace DAL
{

    public class ShopInitialiser : DropCreateDatabaseAlways<ShopContext>
    {
        protected override void Seed(ShopContext context)
        {
            User user = new User() { FirstName = "Anatoliy", LastName = "Nuke", Email = "restroom@ukr.net", Password = "leczpfhfpf1987" };
            context.Users.Add(user);

            ProductCategory pCategory1 = new ProductCategory() { Name = "Вычислительное оборудовани" };
            ProductCategory pCategory2 = new ProductCategory() { Name = "Техника для кухни" };
            ProductCategory pCategory3 = new ProductCategory() { Name = "Техника для ванной" };
            ProductCategory pCategory4 = new ProductCategory() { Name = "Техника для авто" };
            ProductCategory[] pC = { pCategory1, pCategory2, pCategory3, pCategory4 };
            context.ProductCategories.AddRange(pC);

            Product prod1 = new Product() { Name = "ASUS", Price = 10000, Description = "Low Price and performance", Category = pCategory1 };
            context.Products.Add(prod1);
            context.SaveChanges();
        }
    }
}
